package com.usian.controller;

import com.usian.pojo.User;
import com.usian.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
public class UserController {
    @Autowired
    private UserService userService;
    @RequestMapping("findById/{id}")
    public User findById(@PathVariable Integer id){
        return userService.findById(id);
    }
    @GetMapping("findByName")
    public User findByName(Integer id){
        return userService.findById(id);
    }
    @PostMapping("findByUser")
    public User findByUser(@RequestBody User user){
        return userService.findById(user.getId());
    }
}
